<div>
    <h2>Heroes</h2>
    <ul class="heroes">
        <li *ngFor="let hero of heroes" (click)="onSelect(hero)" [class.selected]="hero===chero">
            <span class="badge">{{hero.id}}</span>{{hero.name}}
            <button class="delete" (click)="delete(hero);$event.stopPropagation()">x</button>
        </li>
    </ul>
    <app-herodetail [chero]="chero"></app-herodetail>
</div>
<div>
    <label>Hero name:</label>
    <input #heroName>
    <button (click)="add(heroName.value); heroName.value=''">添加</button>
</div>